package org.springblade.pm.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R;
import org.springblade.pm.entity.Active;
import org.springblade.pm.mapper.ActiveMapper;
import org.springblade.pm.service.IActiveService;
import org.springframework.stereotype.Service;


import java.util.List;
import java.util.Map;

@Service
@AllArgsConstructor
public class ActiveServiceImpl extends BaseServiceImpl<ActiveMapper,Active> implements IActiveService {

	ActiveMapper activeMapper;

	@Override
	public List<Map<String, Object>> getFile(Integer id) {
		return activeMapper.getFile(id);

	}

	@Override
	public List<Map<String, Object>> activeList(Map<String, Object> params) {
		return activeMapper.activeList(params);
	}

	@Override
	public Boolean updateActiveStatus(Integer id, String activeStatus) {
		Active active = new Active();
		active.setActiveStatus(activeStatus);
		UpdateWrapper<Active> updateWrapper = new UpdateWrapper<>();
		updateWrapper.eq("id",id);
		Integer result = activeMapper.update(active,updateWrapper);
		if (null != result && result >= 1) {
			return true;
		}
		return false;
	}
}
